package com.woniu.controller;

import cn.hutool.core.lang.Snowflake;
import com.woniu.util.R;
import com.woniu.vo.CodeVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@Slf4j
public class CodeController {

    @Resource
    Snowflake snowflake;

    @GetMapping("/getCode")
    public R getCode() {

        long codeId = snowflake.nextId();

        CodeVo codeVo = new CodeVo();

        codeVo.setCodeId(codeId+"");

        return R.build(200,"验证码", codeVo);
    }
}
